﻿//JumbotCms_4.1 Final
using System;
using System.Web;
using System.Data;
using Jumbot.Common;
using JumbotCms.Common;
namespace JumbotCms.WebFile.User
{
    public partial class _pmsendajax : JumbotCms.API.UserCenter
    {
        private string _operType = string.Empty;
        private string _response = string.Empty;

        protected void Page_Load(object sender, EventArgs e)

        {
            if (!CheckFormUrl())
            {
                Response.Write("提交有误");
                Response.End();
            }

            this._operType = q("oper");
            switch (this._operType)
            {
                case "checkname":
                    ajaxCheckName();
                    break;
                default:
                    DefaultResponse();
                    break;
            }
            Response.Write(this._response);
        }
        private void DefaultResponse()
        {
            User_Load("", "json");
        }
        private void ajaxCheckName()
        {
            User_Load("", "json");
            if (q("txtUserName") == UserName)
                this._response = JsonResult(0, "0");
            else
            {
                doh.Reset();
                doh.ConditionExpress = "username=@username";
                doh.AddConditionParameter("@username", q("txtUserName"));
                string _uId = Str2Str(doh.GetValue("jcms_normal_user", "id").ToString());
                if (_uId == "0")
                    this._response = JsonResult(0, "0");
                else
                    this._response = JsonResult(1, _uId);
            }
        }
    }
}
